<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE HTML>
<html>
<head>

<title>My JSP 'editquestion.jsp' starting page</title>
<link href="img/ico.ico" rel="shortcut icon">

<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<script type="text/javascript" src="js/jquery-min.js"></script>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<style type="text/css">
.questionForm {
	padding-left: 20%;
}

.content {
	padding-left: 20%;
}

.noUser {
	padding-left: 20%;
}
</style>
</head>
<body>
	<%@ include file="pagetop/pagetitle.jsp"%>
	<c:if test="${not empty user}">
		<div class="content">
			<i class="icon-home"></i><a href="index.action">回主页</a>&gt;&gt;&gt;&gt;&gt;
			<i class="icon-question-sign"></i><a
				href="oneQuestion.action?questionId=${question.id}">${question.questionname}</a>
			&gt;&gt;&gt;&gt;&gt; <i class="icon-edit"></i><span>编辑问题</span>
		</div>
		<hr />
		<div class="questionForm">
			<form action="updateQuestion.action">
				问题名： <input type="text" name="question.questionname"
					value="${question.questionname}" /><span style="color: #999;"><br />
				问题类型:<select name="questiontypeId">
					<option>${question.questiontype.name}</option>
					<c:forEach var="questiontype" items="${questiontypesList}">
						<c:if test="${questiontype.id!=question.questiontype.id}">
							<option value="${questiontype.id}">${questiontype.name}</option>
						</c:if>	
					</c:forEach>
				</select>
					--------${question.user.username}提出</span> <input type="hidden"
					name="question.id" value="${question.id}" />
			</form>

			<a class="btn btn-success" id="editBtn" href="javascript:viod(0)">
				<i class="icon-trash icon-edit"></i> 编辑 </a>
		</div>
	</c:if>
	<c:if test="${empty user}">
		<span class="notUser">${user}</span>
		<span class="noUser">您还没登陆,</span>
		<a href="login.action?task=login">登陆</a>

	</c:if>
</body>
<script type="text/javascript">
	$(function() {
		/*var notUser = $(".notUser").val();
		if(notUser==""||notUser==null){
			setTimeout(function tiaozhuan() {
				window.location.href = "login.action?task=login";
			}, 3000);
			return false;
		}*/
	});
	$(function() {
		$("#editBtn").click(function() {
			//alert("'");
			if ($("input[name='question.questionname']").val().trim() == "") {
				alert("你要修改的问题为空！");
				return false;
			}
			$("form").submit();
		});
	});
</script>


</html>
